<<<<<<< HEAD ======= >>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d <<<<<<< HEAD ======= >>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d

R Markdown

<<<<<<< HEAD

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

=======

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

>>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d
summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

<<<<<<< HEAD

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

hist(mtcars$mpg, main = "John's Graph")

# Map data
library(gapminder)
## Warning: package 'gapminder' was built under R version 4.1.3
library(ggplot2)

library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.3
=======

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

library(gapminder)
library(ggplot2)
library(dplyr)
>>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
<<<<<<< HEAD
library(raster)
## Warning: package 'raster' was built under R version 4.1.3
## Loading required package: sp
## Warning: package 'sp' was built under R version 4.1.3
=======
gapminder %>% filter(year==1992) %>% ggplot(aes(x=lifeExp)) + geom_histogram() + ggtitle("Life Expectancy in the Year 1992")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

library(gapminder) 
library(ggplot2)
gap <- gapminder
plot(lifeExp ~ year, data=gapminder, main="Rachel's Graph")

hist(mtcars$mpg, main = "John's Graph")

# Map data
library(gapminder)
library(ggplot2)
library(dplyr)
library(raster)
## Loading required package: sp
>>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d
## 
## Attaching package: 'raster'
## The following object is masked from 'package:dplyr':
## 
##     select
library(rgdal)
<<<<<<< HEAD
## Warning: package 'rgdal' was built under R version 4.1.3
======= >>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## 
## rgdal: version: 1.5-32, (SVN revision 1176)
## Geospatial Data Abstraction Library extensions to R successfully loaded
<<<<<<< HEAD
## Loaded GDAL runtime: GDAL 3.4.1, released 2021/12/27
## Path to GDAL shared files: C:/Users/malla/OneDrive/Documents/R/win-library/4.1/rgdal/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/malla/OneDrive/Documents/R/win-library/4.1/rgdal/proj
=======
## Loaded GDAL runtime: GDAL 3.3.2, released 2021/09/01
## Path to GDAL shared files: C:/Users/huda/AppData/Local/R/win-library/4.2/rgdal/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/huda/AppData/Local/R/win-library/4.2/rgdal/proj
>>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d
## PROJ CDN enabled: FALSE
## Linking to sp version:1.4-7
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
DSM_HARV <- raster("data/HARV_dsmCrop.tif")
summary(DSM_HARV)
## Warning in .local(object, ...): summary is an estimate based on a sample of 1e+05 cells (4.31% of all cells)
##         HARV_dsmCrop
## Min.        305.5500
## 1st Qu.     345.6500
## Median      359.6450
## 3rd Qu.     374.2825
## Max.        413.9000
## NA's          0.0000
#dsmCrop
DSM_HARV_df <- as.data.frame(DSM_HARV, xy=TRUE)
ggplot() + geom_raster(data = DSM_HARV_df, aes(x = x, y = y, fill = HARV_dsmCrop)) + 
  scale_fill_viridis_c() + ggtitle("John's Graph") + 
  coord_quickmap()

#rgb
Ortho_wNA <- raster("data/HARV_Ortho_wNA.tif")
Ortho_wNa_df <- as.data.frame(Ortho_wNA, xy=TRUE)

ggplot() + geom_raster(data = Ortho_wNa_df, aes(x = x, y = y, fill = HARV_Ortho_wNA)) + 
<<<<<<< HEAD
  ggtitle("John's Graph") + 
  coord_quickmap()

Using our two data files, I used them to create rasters, which I then converted to data frames so that geom_raster would work better on them. I titled both graphs as “John’s Graph” as a title to clarify.

#making stack
HARV_Ortho_stack <- brick("data/HARV_Ortho_wNA.tif")
plotRGB(HARV_Ortho_stack, main = "title")

======= scale_fill_viridis_c() + ggtitle("John's Graph") + coord_quickmap()

Using our two data files, I used them to create rasters, which I then converted to data frames so that geom_raster would work better on them. I titled both graphs as “John’s Graph” as a title to clarify.

>>>>>>> 9075e67bba46550bc04c2bf8165f193b20a8121d